package com.faiz.example.springtest.service.impl;

import com.faiz.example.springtest.dao.mapper.TeacherMapper;
import com.faiz.example.springtest.entity.Teacher;
import com.faiz.example.springtest.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TeacherServiceImpl implements TeacherService {
    private final TeacherMapper teacherMapper;

    @Autowired
    public TeacherServiceImpl(TeacherMapper teacherMapper) {
        this.teacherMapper = teacherMapper;
    }

    @Override
    public List<Teacher> selectAllTeacher() {
        return teacherMapper.selectAllTeacher();
    }

    @Override
    public Teacher upsertTeacher(Teacher teacher) {
        int i = teacherMapper.upsertTeacher(teacher);
        System.out.println("影响了"+i+"行！！！");
        return teacher;
    }
}
